package org.jmc.refmanager.web.wicket.page.service;

import org.apache.wicket.PageParameters;
import org.apache.wicket.authorization.strategies.role.annotations.AuthorizeInstantiation;
import org.apache.wicket.markup.html.basic.Label;
import org.jmc.refmanager.web.wicket.form.ServiceViewForm;
import org.jmc.refmanager.web.wicket.model.ServiceModel;
import org.jmc.refmanager.web.wicket.page.search.ServicesListPage;
import org.jmc.refmanager.web.wicket.page.template.TemplatePage;

/**
 */
@AuthorizeInstantiation(value={"ROLE_MODIF", "ROLE_APPROVER"})
public class ServiceViewPage extends TemplatePage {

	/**
	 * 
	 */
	public ServiceViewPage() {
		super();
		initComponents(null);
	}

	/**
	 * @param parameters
	 */
	public ServiceViewPage(PageParameters parameters) {
		super(parameters);
		initComponents(parameters);
	}

	private void initComponents(PageParameters parameters) {
		add(new Label("pageTitle", "Consultation du service"));
		
		final Integer id = parameters.getAsInteger("id");
		ServiceViewForm viewForm = new ServiceViewForm("viewForm", new ServiceModel(id), ServicesListPage.class);
		add(viewForm);
	}
}
